﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Mail;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class FeedBackPage : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        bool IsDelivered = true;

        try
        {
            EmailHelper.SendEmailToAdmin(txtUserEmailId.Text, txtSubject.Text, txtMessage.Text);
            EmailHelper.SendConfermationEmailToUser(txtUserEmailId.Text, txtSubject.Text, txtMessage.Text);
        }
        catch (Exception ex)
        {
            lblSentSuccessFully.Text = "Sorry, We are unable to deliver your message. Please try after some time.";
            IsDelivered = false;

            Logger.WriteExceptionLog(ex);
        }

        if (IsDelivered)
        {
            lblSentSuccessFully.Text = "Your message has sent successfully";
            txtName.Text = string.Empty;
            txtUserEmailId.Text = string.Empty;
            txtSubject.Text = string.Empty;
            txtMessage.Text = string.Empty;
        }
    }
}